﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Edit.aspx.cs" Inherits="FisheryPlatform.Web.Admin.Account.Edit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register TagName="Style" TagPrefix="Menu" Src="~/Modules/Menu/StyleMenu.ascx" %>
<%@ Register TagName="Left" TagPrefix="Menu" Src="~/Modules/Menu/LeftMenu.ascx" %>
<%@ Register TagName="Header" TagPrefix="Menu" Src="~/Modules/Menu/HeaderMenu.ascx" %>
<%@ Register TagName="Footer" TagPrefix="Menu" Src="~/Modules/Menu/FooterMenu.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <Menu:Style runat="server" ID="menuStyle" Title="Hi"></Menu:Style>
    <% if (IsPostBack)
       { %>
    <script type="text/javascript">
    switch (<%=flag %>) {
        case 1: alert("保存成功"); break ;
        case 2: alert("保存失败"); break;
        default: break;
     }
    </script>
    <%} %>
</head>
<body>
    <div class="wrapper">
        <Menu:Header runat="server" ID="menuHeader" />
        <div class="content">
            <Menu:Left runat="server" ID="menu_Left" />
            <div class="right">
                <div class="top">
                    用户管理>>用户编辑</div>
                <div class="bottom">
                    <form id="form1" runat="server">
                    <div class="edit">
                        <dl>
                            <dt>登录名：</dt><dd><input type="text" runat="server" id="txt_LoginName" class="txt_border txt_input1"/></dd>
                            <dt>名字：</dt><dd><input type="text" runat="server" id="txt_Name" class="txt_border txt_input1"/></dd>
                            <dt>EMail：</dt><dd><input type="text" runat="server" id="txt_EMail" class="txt_border txt_input1"/></dd>
                            <dt>手机：</dt><dd><input type="text" runat="server" id="txt_Mobile" class="txt_border txt_input1"/></dd>
                            <dt>电话：</dt><dd><input type="text" runat="server" id="txt_Phone" class="txt_border txt_input1"/></dd>
                            <dt>新密码：</dt><dd><input type="password" runat="server" id="txt_Password" class="txt_border txt_input1"/></dd>
                            <dt>确认密码：</dt><dd><input type="password" runat="server" id="txt_ComfirmPassword" class="txt_border txt_input1"/><span
                                style="display: none" id="txt_ComfirmPassword_tips">两次密码不一致</span></dd>
                            <%if (isNewAdd == false)
                              { %>
                            <dt>&nbsp;</dt><dd>密码为空不会更新</dd>
                            <%} %>
                            <dt>&nbsp;</dt><dd><input type="submit" value="保存" /></dd>
                        </dl>
                    </div>
                    </form>
                </div>
            </div>
        </div>
        <Menu:Footer runat="server" ID="menuFooter" />
    </div>
</body>
</html>
<script type="text/javascript">
    (function () {
        var isNewAdd = '<%=isNewAdd %>' == 'Ture' ? true : false;
        function validatePassword() {
            if (isNewAdd) {
                if (jDoc("txt_ComfirmPassword").value.trim() == "") {
                    return false;
                }
            }
            if (jDoc("txt_ComfirmPassword").value != jDoc("txt_Password").value) {
                jDoc("txt_ComfirmPassword_tips").style.display = "";
                return false;
            } else {
                jDoc("txt_ComfirmPassword_tips").style.display = "none";
                return true;
            }
        }
        //ElementValidator.className = { error: "error1", def: "tips", focus: "tips", correct: "correct" };
        var formValidator = new ElementValidator();
        formValidator.addText({ id: "txt_LoginName", focus: "请输入登录名", defTips: "登录名必填", len: { text: /^.{4,30}$/, errorMsg: "名字由4-30个字符组成" }, tips: { correctMsg: "OK"} });
        formValidator.addText({ id: "txt_Name", focus: "请输入名字", defTips: "名字必填", len: { text: /^.{2,100}$/, errorMsg: "名字由2-10个字符组成" }, tips: { correctMsg: "OK"} });
        formValidator.addText({ id: "txt_Mobile", focus: "请输入手机号", defTips: "手机必填", len: { text: RegValidator.RegTextEnum.mobile, errorMsg: "手机号填写错误" }, tips: { correctMsg: "OK"} });
        formValidator.addText({ id: "txt_EMail", focus: "", defTips: "", reg: { text: RegValidator.RegTextEnum.email, errorMsg: "EMail填写错误" }, tips: { correctMsg: "OK"} });
        if (isNewAdd) {
            formValidator.addText({ id: "txt_Password", focus: "请输入新秘密", defTips: "", len: { text: /^.{6,20}$/, errorMsg: "密码由6-20个字符组成" }, tips: { correctMsg: "OK"} });
        } else {
            formValidator.addText({ id: "txt_Password", focus: "请输入新秘密", defTips: "", reg: { text: /^.{6,20}$/, errorMsg: "密码由6-20个字符组成" }, tips: { correctMsg: "OK"} });
        }

        //formValidator.addText({ id: "txt_ComfirmPassword", focus: "请输入确认密码", defTips: "", len: { text: RegValidator.RegTextEnum.mobile, errorMsg: "手机号填写错误" }, tips: { correctMsg: "OK"} });
        $(jDoc("txt_ComfirmPassword")).bind("blur", validatePassword);
        $(jDoc("form1")).bind("submit", function () {
            if (formValidator.validate() && validatePassword()) {
                return true;
            }
            return false;
        });
    })()
</script>
